<template>
  <div id="app" class="content">
    <!--    <home-page></home-page>-->
    <router-view></router-view>
  </div>
</template>
<script>
import '@/assets/js/flexible.js'
import {getCookies, setCookies} from "@/assets/js/api";

let _time
export default {
  name: 'App',
  data: function () {
    return {}
  },
  watch: {},
  mounted() {
    this.testCookie()
  },
  methods: {
    testCookie() {
      document.addEventListener('mousemove', () => {
        if (this.$route.path === '/home') {
          let {name, pwd} = getCookies()
          setCookies(name, pwd)
        }
      })
      _time = setInterval(() => {
        let {name} = getCookies()
        if (!name) {
          if (this.$route.path !== '/login') {
            this.$router.push({path: '/login'})
          }
        }
      }, 100)
    }
  },
  beforeDestroy() {
    clearInterval(_time)
  },
}
</script>

<style>
#app {
  position: relative;
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

</style>

